Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Shirt and Pants changing script respawning players, how to stop it respawning?

Asked by 8 years ago

So, I have a script which is in a ScreenGUI, when you click it, it gives you the shirt and pants, but respawns you... Is there a way to prevent it from doing so?

Local (inside Script)

----------
local ShirtID = 265290002
local PantsID = 265290591
----------
local base = "http://www.roblox.com/asset/?id="
local plr = game.Players.LocalPlayer
repeat wait() until plr and plr:IsA("Player") and plr.Character
local char = plr.Character
local sb, pb = nil, nil

function Change(o,id)
local cl = o:Clone() 
if o:IsA("Shirt") then 
sb = o.ShirtTemplate
cl.ShirtTemplate = base .. id
cl.Name = "Shirt"
else
pb = o.PantsTemplate
cl.PantsTemplate = base .. id
cl.Name = "Pants"
end
cl.Parent = o.Parent game:service("Debris"):AddItem(o,.1)
end

script.Parent.MouseButton1Click:connect(function()
if plr:findFirstChild("UniformOff") then for i,v in pairs(plr:children()) do if v.Name == "UniformOff" then v:Destroy() end end
else local bl = Instance.new("BoolValue",plr) bl.Name = "UniformOff"
end script.Script.Disabled = false
end)

if not plr:findFirstChild("UniformOff") then
char.ChildAdded:connect(function(o)
if o:IsA("Shirt") and not sb then Change(o,ShirtID)
elseif o:IsA("Pants") and not pb then Change(o,PantsID)
end
end)
coroutine.resume(coroutine.create(function() wait(5)
if not sb then Change(Instance.new("Shirt",char),ShirtID) end
if not pb then Change(Instance.new("Pants",char),ShirtID) end
end))
else script.Parent.Text = "Uniform: Off"
end
end

Script

local plr = script.Parent.Parent.Parent.Parent.Parent
repeat wait() until plr and plr:IsA("Player") and plr.Character
plr:LoadCharacter()
0
Just take out the code that makes you respawn.... Perci1 4988 — 8y
0
...... TheHospitalDev 1134 — 8y

Answer this question