game.Players.Abysswalk.Chatted:connect(function(msg) if msg == "Spread" then -- right here I tried to make my humanoid jump but it wont work end end)
I put the above piece into a script im working on and it dont work. Well, Im pretty sure i didnt do something right lol
I asked this question before but i messed up lol
any help?
This should all be in a regular script in ServerScript service
Now there are a few problems with your script. First of all, this would instantly error if the player "Abysswalk" wasn't in the game when the script loaded. So in order to get this to never error I would suggest the PlayerAdded
event. Like so,
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) if msg == "Spread" then -- right here I tried to make my humanoid jump but it wont work end end) end)
Okay, now when any player joins the game and chats the Message "Spread" the commented area will activate. Now, if you're trying to make the character Jump when this is Chatted
then you would get the character from the player using plr.Character
.After that, you would find the Humanoid
of the character and activate the Jump
property. Like so,
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) if msg == "Spread" then plr.Character:FindFirstChild("Humanoid").Jump = true -- makes Player's character jump. end end) end)
That should work BUT, if you want it to only work for you, you would have to check to see if the player's name was the same as yours. And because when testing on Roblox Studio
your characters name is always just "Player" you should also add that for the check as well. Like so,
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) if msg == "Spread" then if plr.Name == "Abysswalk" or plr.Name == "Player" then -- also checks name plr.Character:FindFirstChild("Humanoid").Jump = true end end end) end)
Hope that helped! Good Luck!
The wiki is an amazing place
local char = game.Players:FindFirstChild("Abysswalk").Character game.Players.Abysswalk.Chatted:connect(function(msg) if msg == "Spread" then char.Humanoid.Jump = true end end)
try that it might just work
also make sure if your testing it online if it doesn't work it might need to be a local script