Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Model doesn’t get destroyed using remote function ?


TS.OnServerInvoke = function(player,car,hum,particle,Helmet,costume,copycat,weld)
     hum.WalkSpeed = 0
     wait(0.5)
     local new = Instance.new("Animation")
     new.AnimationId = changeid
     local newtrack = hum:LoadAnimation(new)
     newtrack:Play()
     wait(1)
     costume = particle:Clone()
     costume.CFrame = car.UpperTorso.CFrame * CFrame.new(0,5,0)
     costume.Anchored = true
     costume.Parent = car.UpperTorso
     wait(1)
     hum:RemoveAccessories()
     copycat = Helmet:Clone()
     copycat.CFrame = car.Head.CFrame * CFrame.new(0,0.75,0)
     weld = Instance.new("Weld")
     weld.Parent = copycat
     weld.Part0 = car.Head
     weld.Part1 = copycat
     weld.C0 = car.Head.CFrame:Inverse()
     weld.C1 = copycat.CFrame:Inverse()
     copycat.Parent = game.Workspace
     car.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=53557909"
     car.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=53558597"
     wait(1)
     hum.WalkSpeed = 16
     costume:Destroy()
     new:Destroy()
     return copycat,weld
end

TC.OnServerInvoke = function(player,car,hum,particle,Helmet,costume,copycat,weld,empty,ShirtId,Pants)
   hum.WalkSpeed = 0
     wait(0.5)
     local Debris = game:GetService("Debris")
     local new = Instance.new("Animation")
     new.AnimationId = changeid
     local newtrack = hum:LoadAnimation(new)
     newtrack:Play()
     wait(1)
     costume = particle:Clone()
     costume.CFrame = car.UpperTorso.CFrame * CFrame.new(0,5,0)
     costume.Anchored = true
     costume.Parent = car.UpperTorso
     wait(1)
     Debris:AddItem(copycat)
     Debris:AddItem(weld)
     car.Shirt.ShirtTemplate = ShirtId
     car.Pants.PantsTemplate = Pants
     wait(1)
     hum.WalkSpeed = 16
     costume:Destroy()
     new:Destroy()
     return copycat,weld
end

So, I tried destroying a model in a remote function, but it didn’t work. I used Debris and Destroy and returned the function. Any idea ?

2 comments

0

connect functions

0

How do I connect it ?

1 answer

✓ Accepted answer

Maybe is because of your invoke method. Try using instead of

TS.OnServerInvoke = 
function()

write

local function function_name(player and etc)
	-- etc
end

TS.OnServerInvoke = function_name

5 comments

0

Is that in the local script

0

No, on server script. If you use OnServerInvoke it has to be in server script, otherwise is OnClentInvoke

0

err i dont think that works, i think u shoudl connect

0

How ? Mind giving an example ?

0

what did you put in the local script @eyad27 ?

This discussion is preserved as it was. New answers, comments, and votes are closed.