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

This does not work in a server but works in studio so I am confused????

Asked by 7 years ago

script.Parent.Touched:connect(function(char) local player = game.Players:GetPlayerFromCharacter(char.Parent) player:WaitForChild("PlayerGui"):WaitForChild("Level1GUI").TextLabel:TweenPosition(UDim2.new(0.5, 0,0.5, 0),"In","Sine") wait(3) player.PlayerGui.Level1GUI.TextLabel:TweenPosition(UDim2.new(0.5, 0,-0.5, 0),"Out","Sine") player.PlayerGui:WaitForChild("Level1INFO").TextLabel.Text = workspace.Stage1.Info.Value player:WaitForChild("PlayerGui").Level1INFO.TextLabel:TweenPosition(UDim2.new(0.5, 0,0.5, 0),"In","Sine") wait(8) player.PlayerGui.Level1INFO.TextLabel:TweenPosition(UDim2.new(0.5, 0,-0.5, 0),"In","Sine") end)

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You should never access GUIS with a ServerScript.

Instead, a LocalScript is better.

local Part = game.Workspace:WaitForChild('Object') -- Assuming you wrote this code, you must know how to define a variable.
local plr = game.Players.LocalPlayer
local Level1GUI = plr:FindFirstChild('PlayerGui'):WaitForChild('Level1GUI')
local Level1INFO = plr:FindFirstChild('PlayerGui'):WaitForChild('Level1INFO')

Part.Touched:Connect(function()
    Level1GUI.TextLabel:TweenPosition(UDim2.new(0.5,0,0.5),'In','Sine',2.5) -- you made a mistake here
    wait(3)
    Level1GUI.TextLabel:TweenPosition(UDim2.new(0.5, 0,-0.5),"Out","Sine",2.5) -- made same mistake with tweening
    Level1INFO.TextLabel:TweenPosition(UDim2.new(0.5, 0,0.5),"In","Sine",2.5) -- duno why you made mistake for all of them
    wait(8)
    Level1INFO.TextLabel:TweenPosition(UDim2.new(0.5, 0,-0.5),"In","Sine",2.5)  
end)

Should work if you know how to change this to your desire, else, you just copied this code full of errors. If this doesn't work, comment on this answer and I will help you.

If this helped you in anyway, please Upvote and accept answer. Thank you.

Always learn the basics before making a game

-- Your Orange, BlackOrange3343

PS: Good Luck on your game!

0
Did not work SparkleTimeGold 2 — 7y
0
Should work if you knew how to change it BlackOrange3343 2676 — 7y
0
If you just copy pasted it won't work BlackOrange3343 2676 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

local Part = workspace.LevelShowerBricks:WaitForChild('Level1') local plr = game.Players.LocalPlayer local Level1GUI = plr:FindFirstChild('PlayerGui'):WaitForChild('Level1GUI') local Level1INFO = plr:FindFirstChild('PlayerGui'):WaitForChild('Level1INFO')

Part.Touched:connect(function() Level1GUI.TextLabel:TweenPosition(UDim2.new(0.5,0,0.5),'In','Sine',2.5) -- you made a mistake here wait(3) Level1GUI.TextLabel:TweenPosition(UDim2.new(0.5, 0,-0.5),"Out","Sine",2.5) -- made same mistake with tweening Level1INFO.TextLabel:TweenPosition(UDim2.new(0.5, 0,0.5),"In","Sine",2.5) -- duno why you made mistake for all of them wait(8) Level1INFO.TextLabel:TweenPosition(UDim2.new(0.5, 0,-0.5),"In","Sine",2.5)
end)

0
I did that SparkleTimeGold 2 — 7y

Answer this question