Help needed with script

okay, give me a min. ill rewrite the code and send it

Thank you! You have been a real help! :smiley:

np :slight_smile:
try this

script.Parent.Activated:Connect(function()
local hum = script.Parent.Parent:FindFirstChild("Humanoid")
script.Parent.Handle.ParticleEmitter.Enabled = true
script.Parent.Handle.ParticleEmitter.Parent = script.Parent.Parent.HumanoidRootPart
hum.WalkSpeed *= speed
end)

script.Parent.Unequipped:Connect(function()
local hum = game.Player.LocalPlayer.Character.Humanoid
hum.Parent.HumanoidRootPart.ParticleEmitter.Parent = script.Parent.Handle
script.Parent.Handle.ParticleEmitter.Enabled = false
hum.WalkSpeed = 16
end)

Oh no wait
this is for local script… 1 min. ill send another script

yeah lol, it said that in output

local name
script.Parent.Activated:Connect(function()
local hum = script.Parent.Parent:FindFirstChild("Humanoid")
name = hum.Parent.Name
script.Parent.Handle.ParticleEmitter.Enabled = true
script.Parent.Handle.ParticleEmitter.Parent = script.Parent.Parent.HumanoidRootPart
hum.WalkSpeed *= speed
end)

script.Parent.Unequipped:Connect(function()
local hum = game.Player:FindFirstChild(name).Character.Humanoid
hum.Parent.HumanoidRootPart.ParticleEmitter.Parent = script.Parent.Handle
script.Parent.Handle.ParticleEmitter.Enabled = false
hum.WalkSpeed = 16
end)

try this

ParticleEmitter is not a valid member of Part “Workspace.youdowwnnn.Pink Stone.Handle”

I can definitely tell that the particle seems to be the problem. I guess I just need to get rid of it.

The reason it’s not working is because when a tool gets unequipped, it gets parented to the player’s Backpack instead of their character, and the script is assuming that it’s still in the character, so all you have to do is get the player from the player’s Backpack

script.Parent.Unequipped:Connect(function()
    local player = script.Parent:FindFirstAncestorOfClass("Player")
    local hum = player.Character.Humanoid
    script.Parent.Parent.Parent.Player.Humanoid.ParticleEmitter.Enabled = true
    script.Parent.Handle.ParticleEmitter.Parent = script.Parent.Handle
    hum.WalkSpeed = 16
end)
1 Like

ig that’s not the problem here @GalaxyGourmet

Ok I see what you mean by that

what he said is actually true, but I have tried a different approach in my recent script and the error you are getting is not cus of that…

What was the error?

sadsadfsadfasd

this one Help needed with script - #45 by sufsty

Oh yeah, that one is still in the output. @galaxygourmet his verson of the script was also giving out that error

ya what he gave won’t fix it…

1 Like

I think i’ll just have to get rid of the particle completely or I might need to put the particle in ServerStorage so that I could use a :clone too do it

The Second function Unequipped is the reason for your error when unequipping, Since you are unequipping the Tool, its going into the Player’s Backpack, So you are trying to get a Character that is nil

Use a RemoteEvent:
Server (Tool)

script.Parent.Fire.OnServerEvent:Connect(function(Plr)
script.Parent.Handle.ParticleEmitter.Enabled = true
script.Parent.Handle.ParticleEmitter.Parent = Plr.Character.HumanoidRootPart

end)

script.Parent.Unequipping.OnServerEvent:Connect(function(Plr)
script.Parent.Handle.ParticleEmitter.Enabled = false
script.Parent.Handle.ParticleEmitter.Parent = script.Parent.Handle

end)

Client: (LocalScript, Tool)

script.Parent.Activated:Connect(function()
script.Parent.Fire:FireServer(Player.WalkSpeed * 4)
end
script.Parent.Unequipped:Connect(function()
script.Parent.Unequipping:FireServer(Player.WalkSpeed = 16)
end

So your Tool should look like this:
Screenshot (62)

Ohhhhh. So if I delete where i’m trying to get character, do you think it will work?

Updated the code

character limit