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

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

Asked by 6 years ago
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"

0
maybe : the error or "For some reason i cannot destroy this object in character?" abnotaddable 920 — 6y

1 answer

Log in to vote
1
Answered by
CootKitty 311 Moderation Voter
6 years ago

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
1
State why the answer works so they actually learn? frostysubatomiczero 51 — 6y
0
Thought about doing that. CootKitty 311 — 6y
Ad

Answer this question