For some reason, my pretty short script just refuses to print out or do anything after declaring variables, does anyone have an answer? I think it may actually be the wait for child and wait() but I don't know, because I just started Lua. Code:
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local health = humanoid.Health
print(player)
print(character)
print(humanoid)
and another one, in which it does work but, I can't use the variable or functions declared:
local player = game.Players.LocalPlayer
UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, typing)
if typing then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print(player, " pressed lmb")
end
end)
local character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local debounce = false
local health = humanoid.Health
I already tried to alter, but it seems that the only variable that I can do print after is player, which is the first one, so I can't get the other ones information.
StarterPlayer.StarterCharacterScripts
, but did you try puttingUIS,InputBegan
and the following code until its end in the end? The code is written in a Local Script, which is why I in the first place usedgame.Players.LocalPlayer