Hello scripting helpers,
This is my 2nd question today and now I want to ask another question.
I've always had problems using LocalScripts. (This script is a LocalScript. I want it to stay a LocalScript too because I'm using game.Players.LocalPlayer instead of figuring out how to get to the player, I like to take the easy route.)
Here is the script I'm talking about.
local Frame = script.Parent.Question -- Fine local Frame2 = script.Parent.Answer -- Fine local Player = game.Players.LocalPlayer -- Fine while true do -- Fine wait(1) -- Fine local InProgress = game.ServerStorage.InProgress -- ERROR local ContestantUp = game.ServerStorage.ContestantUp -- ERROR if InProgress.Value == true and ContestantUp.Value == Player.Name then -- Fine Frame:TweenPosition(UDim2.new(0.1, 0,0.6, 0), "Out", "Quad", 3, false) -- Fine Frame2:TweenPosition(UDim2.new(0.1, 0,0.8, 0), "Out", "Quad", 3, false) -- Fine else -- Fine Frame:TweenPosition(UDim2.new(0.1, 0,-0.6, 0), "Out", "Quad", 3, false) -- Fine Frame2:TweenPosition(UDim2.new(0.1, 0,-0.8, 0), "Out", "Quad", 3, false) -- Fine end -- Fine end -- Fine
The script works fine in studio but not in game. It does not error in studio but it errors in game from looking at the Dev Console. The error is in the video. Here is what I mean:- https://www.youtube.com/watch?v=MseelbLQy2o
Thanks if you help! Nathan.
LocalScripts can't access ServerStorage.
Use ReplicatedStorage, for everything in it is replicated to the client.
Well, there's no way you're going to be able to do this because aquathorn was right. You need to use a server Script in order to access that service. When you want to test things inside of Studio, go to the "Test" tab, and click Start Server. Normal studio mode will sometimes allow things that a normal server wouldn't. Just try this inside of Normal Script for finding the player:
game.Players.PlayerAdded:connect(function(Plr) Player=Plr --This isn't really needed, but you can keep it if you like --Write your code here end)
Ok, so if I didn't need that first part, someone please correct me, but I think this should work for you now. Try it in game if you want, and let me know if it works. Hope I helped :P