Why doesn't this work?

hey so i’ve got this script:

local WorkSpace = game:GetService("Workspace")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local CameraShake = Character:WaitForChild("CameraShake")
script.Parent.Activated:Connect(function()
	workspace.WalkSpeed.Enabled = false
	CameraShake.Enabled = true
end)

everything works but this line

workspace.WalkSpeed.Enabled = false

for some reason doesn’t work (i also tried :Delete() ) but that also did nothing. what am i doing wrong??

WalkSpeed is not an instance inside the workspace, so you can’t just change it’s “value” to false. What you can do though, is set the WalkSpeed of the Humanoid of the player’s character to 0. WalkSpeed is as its name implies, a speed, which is a number. So setting it to false won’t work.
You can replace the last bit of your code with this:

script.Parent.Activated:Connect(function()
	Character.Humanoid.WalkSpeed=0
	CameraShake.Enabled = true
end)

Also for the record,
:Delete() is not something you can do. You can either use :Remove() or :Destroy(). Only on instances though, not on members of an instance.

it worked. Thank you bro,.,.,.,.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.