Hello, we have a value in the character but how to know if it is true or false with a script in the workspace in Legacy?
Thanks for your help.
You can use player.Character as its provided by proximity prompt.
Is the ?
you saying you’re trying to find the character of the player? If so, you can just use player.Character
. And you don’t need to use == true
in the if statement:
local ImEatingOut = true
if ImEatingOut == true then
print("yum")
end
if ImEatingOut then -- same thing as above
print("yum")
end
Also use workspace
not game.workspace
or game.Workspace
.
If I make this, he says this error…
What. Just use player.Character.Activate.Value
, not workspace.player.Character.Activate.Value == true
. If it goes to the else statement, that means Activate.Value is false, and that’s a different problem.
No error but nothing happens (it does not go to else) The value is true.
We have this but he returns to else, i think its player who have problem
I doubt the problem is the player, It’s more likely that it’s the value of the “Activate” object.
Try printing its value before entering the if statement, just to check if it’s set to true or false
Indeed, the console said nothing. It seems that it’s player.name that doesn’t work… The value is functional because I checked on Studio the value in the workspace. Is the tree structure bad?
When you check on studio make sure you check it between server and client.
It could be true on client but on server it will be false.
OK I understand! How can we put the true value for the server and not the client?
I make this but he returns a error:
It errors because .LocalPlayer doesn’t exist on server.
There are 2 methods to resolve this
One method is to use a remote event and send a message when a tool is activated to switch value to true.
Second method is when the tool is equipped the tool is parented under the character model. So you can use tool.Parent to get the character model and the :GetPlayerFromCharacter function to get the player.