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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by
Lugical 425 Moderation Voter
5 years ago

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.

0
Thank you for an example. appleprogamer_59 29 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

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. appleprogamer_59 29 — 5y
0
well this isnt a request site User#23365 30 — 5y
0
i suggest u learn about FE, which is like remote events User#23365 30 — 5y
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. appleprogamer_59 29 — 5y
View all comments (2 more)
0
well, go to yt or wiki and learn about FE User#23365 30 — 5y
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> Lugical 425 — 5y

Answer this question