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

How do i make this tween in servers?

Asked by 7 years ago

The tweening part of this script works perfectly in studio and studio server test but not in the actual game. Everything else works perfectly except the tweening. All i need help with is making the tween work in servers.


local NPC = script.Parent.UpperTorso while true do local ply = game.Players:GetChildren() for i = 1, #ply do local char = game.Workspace:findFirstChild(ply[i].Name) if char ~= nil then if (NPC.Position - char.UpperTorso.Position).magnitude <= 8 then if ply[i]:findFirstChild("TalkingToNPC") then else if ply[i].Gamestuff.Characters.Folder.Class.Value == "None" then local thing = Instance.new("StringValue",ply[i]) thing.Name = "TalkingToNPC" local ChatClone = script.ChatGui:Clone() ChatClone.Name = "ChatClone" ChatClone.Parent = ply[i].PlayerGui ChatClone.Press:TweenPosition(UDim2.new(0.5, -150, 1, -200), "Out", "Back", 0.7, false) ChatClone.KeyPress.Disabled = false elseif ply[i].Gamestuff.Characters.Folder.Class.Value ~= "None" then local thing = Instance.new("StringValue",ply[i]) thing.Name = "TalkingToNPC" local ChatClone = script.ChatGui2:Clone() ChatClone.Name = "ChatClone" ChatClone.Parent = ply[i].PlayerGui ChatClone.Press:TweenPosition(UDim2.new(0.5, -150, 1, -200), "Out", "Back", 0.7, false) ChatClone.KeyPress.Disabled = false end end elseif (NPC.Position - char.UpperTorso.Position).magnitude > 8 then if ply[i].PlayerGui:findFirstChild("ChatGui") or ply[i].PlayerGui:findFirstChild("ChatGui2") or ply[i].PlayerGui:findFirstChild("ChatClone") then --:findFirstChild("TalkingToNPC") ply[i]:findFirstChild("TalkingToNPC"):destroy() ply[i].PlayerGui.ChatClone.Press:TweenPosition(UDim2.new(0.5, -150, 1.5, -200), "In", "Back", 0.7, true) wait(0.8) ply[i].PlayerGui.ChatClone:destroy() end wait() end end end wait(0.1) end

2 answers

Log in to vote
0
Answered by 7 years ago

To lay down a bit of advice, since the latest Roblox Update, I have been having this problem too. Tweening does not trigger from any type of script in Workspace anymore. And, I am assuming that this script works from Workspace, correct?

You now basically have to throw your script into the place you want within PlayerGui and modify your script to work from there.

0
O hey it works User#13357 0 — 7y
0
YAY! @wallopinweb JoeRaptor 72 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

The reason your code works in Roblox Studio is because both server scripts and local scripts are the same when you click on the Play button inside roblox studio. When you wish to test if your game works, use the Start button under Clients and Servers .

Server scripts can't access the PlayerGui.

You'll have to use remote events for that.

If you need an example onto that, I'll gladly help you.

0
It's not because of that. When i first made it it worked all around. I guess its because of a Roblox Update User#13357 0 — 7y

Answer this question