So i finally finished this script. It was originally a local script but for some reason it wouldn't run on servers only in studio test so now its a normal script. Now I have the same problem again.
local player = script.Parent.Parent
local char = player.Character
local hum = player.Character.Humanoid
local canTrans = true
Torso = char.UpperTorso
local mouse = player:GetMouse() --Will use this later
mouse.KeyDown:connect(function(key)--If b is pressed
if key == "b" and canTrans == true then
game:GetService('Chat'):Chat(char.Head,string.upper("i won't let you...!"),1)--make character chat
canTrans = false--cannot spam b to keep transforming
hum.WalkSpeed = 0
hum.MaxHealth = 5000
hum.Health = 5000
if char:FindFirstChild('Humanoid') then --delete accessories
for i,v in pairs(char:GetChildren()) do
if v:IsA'Accoutrement' or v:IsA'Hat' then
game.Debris:AddItem(v, .3);
end
end
part1 = game.ServerStorage.cylinderEX:Clone()--clone cylinder
hum:LoadAnimation(game.ServerStorage.ssjanim):Play()
spawn(function()--Im not really sure what spawn does :P
part1.Parent = workspace
part1.Position = char.UpperTorso.Position
wait()
for i = 1,20 do
part1.Size = part1.Size + Vector3.new(1,1,1)--animate part1
part1.Transparency = part1.Transparency + .05
wait()
end
part1:Destroy()
end)
wait(2)
ball = game.ServerStorage.ball:Clone()--create a new part
ball.Parent = workspace
ball.CFrame = char.UpperTorso.CFrame
spawn(function()
for i = 1,20 do
wait()
ball.Size = ball.Size + Vector3.new(1,1,1)--animate ball
ball.Transparency = ball.Transparency + .05
ball.CFrame = char.UpperTorso.CFrame
end
ball:Destroy()
end)
wait(.3)
game:GetService('Chat'):Chat(char.Head,string.upper("haaaaaaa"),1)--make character chat again
aura = game.ServerStorage.Aura:Clone()
hair = game.ServerStorage.SSJHAIR:Clone()--clone the accessory and make character wear it
hair.Parent = char
wait(.7)
aura.Parent = char.UpperTorso--particleEmitter
hum.WalkSpeed = 25
canTrans = false
end
end
end)
mouse.KeyDown:connect(function(key)
if key == "b" and canTrans == false then--if B is pressed again then
hum.WalkSpeed = 16
hum.MaxHealth = hum.MaxHealth / 50
hum.Health = 100
char.UpperTorso:FindFirstChild("Aura"):Destroy()--Destroy the particleEmitter
if char:FindFirstChild('Humanoid') then --delete accessories
for i,v in pairs(char:GetChildren()) do
if v:IsA'Accoutrement' or v:IsA'Hat' then
game.Debris:AddItem(v, .3);
end
end
wait(5)
canTrans = true
end
end
end)
The script worked fine when the function was called when the player chatted now when its called on keydown it doesn't run when I create a server.

2 comments
Quick tip: you can removes accessories even if they aren't loaded by calling :RemoveAccessories() on a humanoid
Thanks :D