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

Why won't this detection script work?

Asked by 8 years ago
01local part = script.Parent
02 
03game.Players.PlayerAdded:connect(function(plr)
04part.Touched:connect(function(hit)
05    if hit.Name == "auto" .. plr.Name then
06        if game.Lighting.SecretsFolder:FindFirstChild("shrek") then
07        local shrek = game.Lighting.SecretsFolder.shrek
08        shrek.Parent = game.Workspace
09        shrek.Position = part.Position - Vector3.new(3.4, 0, 0)
10        else
11            local p = game.Lighting.SecretsFolder.poo:Clone()
12            p.Parent = game.Workspace
13            p.Position = part.Position + Vector3.new(3.4, 0, 0)
14        end
15    end
16end)
17end)

This works on studio, but no in-game? Why? Thanks for help!

1 answer

Log in to vote
0
Answered by
deris88 146
8 years ago
Edited 8 years ago

I'm not sure why is there hit.Name == "auto"..plr.Name. I assume you wanted make part.Name == "auto".. plr.Name.

01local part = script.Parent
02 
03game.Players.PlayerAdded:connect(function(plr)
04part.Touched:connect(function(hit)
05    if part.Name == "auto" .. plr.Name and game.Players:FindFirstChild(plr.Name) ~= nil then --check if player Exist. Seems like name of script.Parent is adjusted by script. If you name it 'autoPlayer1' in studio and did not rename it to 'autohappyturk4' when you played the game. It could not have worked because it's name was autoPlayer1 not autohappyturk4. However I might be wrong. This script works if script.Parent name would be autohappyturk4
06        if game.Lighting.SecretsFolder:FindFirstChild("shrek") then
07            local shrek = game.Lighting.SecretsFolder.shrek
08            shrek.Parent = game.Workspace
09            shrek.Position = part.Position - Vector3.new(3.4, 0, 0)
10        else
11            local p = game.Lighting.SecretsFolder.poo:Clone()
12            p.Parent = game.Workspace
13            p.Position = part.Position + Vector3.new(3.4, 0, 0)
14        end
15    end
16end)
17end)
0
thats how the script works, thats what the bullet is called.... happyturk4 33 — 8y
0
Well this script works not only in studio deris88 146 — 8y
0
it does happyturk4 33 — 8y
0
So did I answer your question? deris88 146 — 8y
View all comments (3 more)
0
no!?!?! you just came here and told me what i was doing was wrong....thats how the SCRIPT WORKS happyturk4 33 — 8y
0
Well you wanted it to works in game. It does now. You need anything else? deris88 146 — 8y
0
it does NOW? get out kid happyturk4 33 — 8y
Ad

Answer this question