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

I don't know what should be the question so pls click to find out?

local lp = game.Players.LocalPlayer
local anim = game.Players.LocalPlayer.PlayerScripts.AnimOne
local camera = script.Parent.Parent

function run()
if anim.Value == false then
local md = game.Lighting.VipOne:Clone()
anim.Value = true
md.Parent = lp.Character
md:SetPrimaryPartCFrame(lp.Character.HumanoidRootPart.CFrame)
game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
elseif anim.Value == true then 
anim.Value = false
game.Players.LocalPlayer.Character.VipOne:destroy() --or game.Players.LocalPlayer.Character.VipTwo:destroy()
game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
end
end

script.Parent.MouseButton1Down:connect(run)

15th line

all im trying to do is if the VipOne Model is Not in there but the VipTwo is , then i want to remove the VipTwo , i just dont know how can i do that.

sorry about the question thingy , im so pissed that i was not able to come up with a question "i cant talk k"

1 comment

0

maybe : the error or "For some reason i cannot destroy this object in character?"

1 answer

✓ Accepted answer

Try this:

local char = game.Players.LocalPlayer.Character -- use more variables
local x = char:FindFirstChild("VipOne") or char:FindFirstChild("VipTwo") -- get one or the other, if none then nil
if(x)then -- check if nil
    x:Destroy() -- if not destroy
end

2 comments

1

State why the answer works so they actually learn?

0

Thought about doing that.

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