Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script only works in studio and not Roblox. I also get no errors when runing the code?

This script is supposed to check your leader stats if you have more then 50 "Jumps" then it will make a button visible on a frame if you don't it want the same thing for 100 "Jumps". It works in studio but not in the game. I hope you can help me fix this :).

local Frame = script.Parent.Parent.Frame
script.Parent.MouseButton1Click:Connect(function()
Frame.Visible = true	
if game.Players.LocalPlayer.leaderstats.Jumps.Value >= 50 then
script.Parent.Parent.Frame.Trail1.Visible = true
else
	script.Parent.Parent.Frame.Trail1.Visible = false
end

if game.Players.LocalPlayer.leaderstats.Jumps.Value >= 100 then
script.Parent.Parent.Frame.Trail1.Visible = true
script.Parent.Parent.Frame.Trail2.Visible = true 
else
	script.Parent.Parent.Frame.Trail1.Visible = false
	script.Parent.Parent.Frame.Trail2.Visible = false
end
end)

2 answers

✓ Accepted answer

To me, this would be a FilteringEnabled issue. What you're doing is making the major changes on a LocalScript, which would only work on a client-side. To combat this, It'd be best to use RemoteEvents. To show you as an example: LocalScript:

script.Parent.MouseButton1Click:Connect(function(plr)
	game.ReplicatedStorage.RemoteEvent:FireServer(plr)
end)

ServerScript:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
	print(plr.Name.." has clicked the GUI!"
end)
	

This is an example. Don't post it into your scripts. However, try using this to help you into using the RemoteEvents to fix your issue.

1 comment

0

Thank you for an example.

its prob because its not FE compatible, to make it compatible i suggest u learn about FE

6 comments

0

Okay... By telling me what the problem is dose not really help me fix it. Maybe I can get some help making it FE compatible.

0

well this isnt a request site

0

i suggest u learn about FE, which is like remote events

0

Yes this is not a request site. This is a site thats suppost to help you with your scripts. Also I gave you opsions how to fix it or a script. Telling me a posable problem is not going to fix that.

0

well, go to yt or wiki and learn about FE

0

This is a site to help others who have questions about scripting. We can give examples on how to solve the issue, and explain, but we're not to rely on somebody to do the script for you. Can we agree on that>

This discussion is preserved as it was. New answers, comments, and votes are closed.