Player Variable Changes In other Scripts

Godot Version

Version 4.5.1

Question

So i have a variable for my health in my player script such as this on line 18

and want to be able to change it likei in my checkpoint script with something like this

and i just am curious like how to make it affect another scripts variable.

Hi,

ivvyhealth being a variable from the Player class, you need to set it on a Player instance. Basically, in your code, since you’re already checking if body is a Player, you can do that:

body.ivvyhealth = 3

Ohhh perfect thanks i didnt know it worked like that.
One other quick thing, so i have a slope like This


which the player is intended to run up but like i dont know why where its like a code thing or modelling thing or what but it sort of pushes my player down like as if shes sliding down the slope and idea why

I don’t know, I’ve never done any 3D project in Godot, sadly. Feel free to create a new topic for that question, as more people will read it!

Will do! Thanks Again