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

where am i going wrong in the script?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
local redlight = game.Camera.StartLight.RedModel.LightBulb.PointLight
local yellowlight = game.Camera.StartLight.YellowModel.LightBulb.PointLight
local greenlight = game.Camera.StartLight.GreenModel.LightBulb.PointLight
local checkpoint1 = game.Camera.CheckPoint1
local checkpoint2 = game.Camera.CheckPoint2


wait(2)

redlight.Enabled = true
wait(2)
redlight.Enabled = false

yellowlight.Enabled = true
wait(2)
yellowlight.Enabled = false

greenlight.Enabled = true
wait(2)
greenlight.Enabled = false

checkpoint1.Transparency = 0.3
checkpoint1.CanCollide = false

function checkpoint1hit(otherpart)
    print ("checkpoint1 was hit")
    print (otherpart.Name)
    if otherpart ~= nil and otherpart.Parent ~= nil and otherpart.Parent:FindFirstChild("Humanoid")then
        checkpoint2.Transparency = 0.3
        checkpoint2.CanCollide = false
        checkpoint1.Transparency = 2
        checkpoint1.CanCollide = false
        if not checkpoint1:FindFirstChild(otherpart.Parent.Name)then
        local PlayerTag = Instance.new("StringValue")
        PlayerTag.Parent = checkpoint1
        PlayerTag.Name = otherpart.Parent.Name
        end
    end
end

function checkpoint2hit(otherpart)
    print ("checkpoint2 was hit")
    print (otherpart.Name)
    if otherpart ~= nil and otherpart.Parent ~= nil and otherpart.Parent:FindFirstChild("Humanoid")then
        checkpoint2.Transparency = 2
        checkpoint2.CanCollide = false
        if not checkpoint2:FindFirstChild(otherpart.Parent.Name) and checkpoint1:FindFirstChild(otherpart.Parent.Name)then
        local PlayerTag = Instance.new("StringValue")
        PlayerTag.Parent = checkpoint2
        PlayerTag.Name = otherpart.Parent.Name
        end
    end
end
checkpoint1.Touched:connect(checkpoint1hit)
checkpoint2.Touched:connect(checkpoint2hit)

i am making a racing game with checkpoints. the script above is for checkpoints i want the checkpoints to appear for each player in the game so eacher player has to get all of the check points to win the game.

0
What is wrong with it? What does it do? What should it do instead? BlueTaslem 18071 — 8y
0
this script is for race checkpoints. i am trying to make a checkpoint for each player in the game i tried to make it but it does not work. can you help me with it? thegamingpro566 0 — 8y
0
Were you ever able to come up with anything? superdragonhunter64 2 — 7y

Answer this question