i want ppl to be able to reset themselves through a gui
when i click on it it doesnt activate
i tried looking for stuff but didnt get it
function onActivated()
script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
script.Parent.Activated:connect(onActivated)```
anyone? plssss anyone? pls anyone
@uhley360
pls? are u there uhley
do you have any errors in output and is this script local script or server sided script
Try this
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
script.Parent.Activated:Connect(function()
if char and char.Humanoid then
char:FindFirstChild("Humanoid").Health = 0
end
end)
Arlenox
(Arlenox)
June 17, 2021, 8:17am
#6
Try using MouseButton1Clic
instead of Activated
.
EchoWinds
(EchoWinds)
June 17, 2021, 8:18am
#7
All it would’ve took is a simple youtube search, I found so many tutorials on this just by looking it up.
This works perfect for me
Have a good day
is it for local script???
yes local script in your gui
charss
Arlenox
(Arlenox)
June 17, 2021, 8:20am
#11
Just change script.Parent.Activated:connect(onActivated)
to script.Parent.MouseButton1Click:connect(onActivated)
and it should work.
Activated is for Mobile and pc thats not the problem
it doesnt work it says attempt to nil with character
Arlenox
(Arlenox)
June 17, 2021, 8:22am
#14
That’s normal. You cannot use local char = plr.Character or plr.CharacterAdded:Wait()
, you’ll have to use a function instead.
This screenshot is from DevHub of Roblox
Arlenox
(Arlenox)
June 17, 2021, 8:23am
#16
If you don’t know what the script is doing, don’t copy and paste it.
Bro im using that method for character already long time it and works perfect for me please dont say things which you dont know
Edit: and im not “copy pasting” just showing that its method
it works i didnt do local script it works perfeclty
ye it should work cuz it was working perfectly for me
and is there any board of donation for mobile too