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

Why doesn't this function work in roblox player?

Asked by
xNypify 11
5 years ago
Edited 5 years ago

The following script works in studios but not in roblox player, I think the main reason as to why it doesn't work is due to the fact that in studios solo, there is only one player to give it to but in actual roblox servers, there are many players and so it doesn't know which to give it to?? It does print "hit" in both roblox player and studios, which is why I thought ^ was the problem. I could be completely wrong but that's why I'm asking you guys :)

local goldC = script.Parent

switch = false

local function Value(part)

print("hit")

if switch == false then

switch = true

workspace.Events.GoldCoin:FireServer()

goldC.Transparency = 1

wait(15)

goldC.Transparency = 0 

switch = false

end
end

goldC.Touched:connect(Value)

If possible explain as much as you can as to what I did wrong, assuming it was actually not what I thought was wrong, thanks.

0
LocalScripts do not run in Workspace, if they do it's because their parent is a player character. Other than that they will not run elsewhere in the Workspace. Not everything requires a remote event, just make your script a Server Script and do the code there. User#19524 175 — 5y
0
is the script a Local Script or server script hellmatic 1523 — 5y

Answer this question