I want it to set player walkspeed to 0 when equipped, and when its unequipped it should go back to 16.
i also want all parts called ‘SuperVisionBlock’ to only to be visible when the tool is equipped. I want only the people with it equipped to see the blocks so if someone has it equipped they should be the only ones seeing it. (local)
When FilteringEnabled is on, you can toggle properties of parts locally and other clients will not see these changes.
You use the tool’s Equipped and Unequipped event to know when you should enable/disable super vision stuff.
You can change a humanoid’s walkspeed by doing just that, find the Humanoid in the local player’s character (game.Players.LocalPlayer.Character), and then set its WalkSpeed property to whatever you need it to be when equipping/unequipping.
You can search for bricks with a specific name by looping over all instances in workspace, using for example workspace:GetDescendants(), then checking if they are a BasePart and if their name is “SuperVisionBlock”, and then setting their Transparency to whatever you need it to be.
(Note for advanced scripters: CollectionService is a better solution for this)
I recommend trying to script this and come back with whatever you tried, should you still get stuck. Then people will be able to give you more specific feedback on where your script is going wrong.
PS: This fits better in Scripting Support rather than Design Support. You can change the category by hitting the pencil icon next to the title of your thread / your first post in the thread, and selecting Scripting Support in the category dropdown.
-- variables
local tool = script.Parent
local handle = script.Parent:WaitForChild('Handle')
local localplayer = game.Players.LocalPlayer
local supervision = workspace:WaitForChild('SuperVisionBlock')
-- equiped
tool.Equipped:connect(function()
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "SuperVisionBlock" then
supervision.Transparency = 0
localplayer.Character.Humanoid.WalkSpeed = 0
localplayer.Character.Humanoid.JumpPower = 0
end
end
end)
-- unequipped
tool.Unequipped:connect(function()
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "SuperVisionBlock" then
supervision.Transparency = 1
localplayer.Character.Humanoid.WalkSpeed = 16
localplayer.Character.Humanoid.JumpPower = 50
end
end
end)
How do i make it applicable for multiple blocks with the name SuperVisionBlock
So what you’re doing above is only referencing one of the parts in workspace. Try this.
-- variables
local tool = script.Parent
local handle = script.Parent:WaitForChild('Handle')
local localplayer = game.Players.LocalPlayer
local function toggleVisibility(toggle)
for _,x in pairs(workspace:GetChildren()) do
if x.Name == "SuperVisionBlock" then
if (toggle) then
x.Transparency = 1
localplayer.Character.Humanoid.WalkSpeed = 0
localplayer.Character.Humanoid.JumpPower = 0
else
x.Transparency = 0
localplayer.Character.Humanoid.WalkSpeed = 16
localplayer.Character.Humanoid.JumpPower = 50
end
end
end
end
-- equiped
tool.Equipped:connect(function()
toggle(true)
end)
-- unequipped
tool.Unequipped:connect(function()
toggle(false)
end)