local bindableEvent = game.ServerScriptService:WaitForChild("Stun")
local Players = game:GetService("Players")
local function onPlayerAdded(target)
target:SetAttribute("StunCounter", 0)
target:SetAttribute("Stunned",false)
target:SetAttribute("BaseJump", 50)
target:SetAttribute("BaseSpeed",16)
end
Players.PlayerAdded:Connect(onPlayerAdded)
local function onMyEventFired(target,length)
-- Your code to run when the event is triggered
print("InStun")
local BaseSpeed = target:GetAttribute("BaseSpeed")
local BaseJump = target:GetAttribute("BaseJump")
print(BaseSpeed)
target:SetAttribute("StunCounter", target:GetAttribute("StunCounter") + 1)
target:setAttribute("Stunned", true)
target.Character.Humanoid.WalkSpeed = 0
target.Character.Humanoid.JumpPower = 0
wait(length)
target:SetAttribute("StunCounter", target:GetAttribute("StunCounter") - 1)
if target:GetAttribute("StunCounter") == 0 then
target:setAttribute("Stunned", false)
target.Character.Humanoid.WalkSpeed = BaseSpeed
target.Character.Humanoid.JumpPower = BaseJump
end
end
bindableEvent.Event:Connect(onMyEventFired)
#How can I target a players model instead of the player in players folder?
4 messages · Page 1 of 1 (latest)
** You are now Level 3! **