So the basis of my game is a simple click, you get a prompt, and an item. In the studio version, it works perfectly fine, but in the published game, you only get the prompt (from another script). I don't know how to fix this. I've tried replacing it with other versions, but NOTHING will work. Any ideas?
function onClicked(part)
local player = game.Players.LocalPlayer
local giver = game.Players:FindFirstChild(""..player.Name.."")
print("Clicked")
if player ~= nil then
local wep = game.Lighting.Key:clone()
wep.Parent = giver.Backpack
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

9 comments
put it in codeblock to make your code readable.
Done
Is the script a local one or a server side one? What I mean by that is that this script is inside a normal script or a local script.
I believe it's local, if it was server side i'm pretty sure it would work. I do not know how to change it, or what that means entirely. I'm still new to everything and got this from digesting a video
Try putting the script to a server side one, I am pretty sure that is the problem. Click detectors do not work with local scripts, only server side ones.
How would I go about that? Sorry I am new.
Delete the script u have, and a add a normal script(server-side) and paste the code there, that's it!
I understand what you were saying now. It was already a server side script; I got confused because I've never used a local script. Any other ideas?
Check the answer I gave.