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

Is there a way to make this script work with recent updates?

Asked by 6 years ago

So this script is inside StarterGUI inside a GUI that has a text button, it is a script, not a local script, and it dosen't work anymore, can anyone help?

01--[[
02 
03 
04--]]
05function Click()
06script.Parent.Parent.Button.Text = "Teleporting..."
07wait(0.5)
08script.Parent.Parent.Button.Text = "Teleporting."
09wait(0.5)
10script.Parent.Parent.Button.Text = "Teleporting.."
11wait(0.5)
12script.Parent.Parent.Button.Text = "Teleporting..."
13wait(0.5)
14script.Parent.Parent.Button.Text = "Teleporting."
15wait(0.5)
View all 36 lines...
0
I presume you've got FilteringEnabled, therefore any changes to objects should be done by scripts inside ScriptService through use of RemoteEvent, RemoteFunction TippiestEko 15 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

Make the script local. Server scripts can only access the GUI through RemoteEvents.

1
ok that should have been a comment Gey4Jesus69 2705 — 6y
0
lol yeah Kaexotix 57 — 6y
Ad
Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

You need to use a local script to handle the MouseButton1Down event and a server script to handle the change in the UpperTorso's CFrame. With that being said, you'll have to use a remote event to communicate the change. I also included a way to shorten your local script:

1--Server script
2 
3local ReplicatedStorage = game:GetService("ReplicatedStorage")
4local Remote = Instance.new("RemoteEvent") --create remote
5Remote.Parent = ReplicatedStorage
6 
7Remote.OnServerEvent:Connect(function(player)
8   player.Character.UpperTorso.CFrame = CFrame.new(0,.5,4.7)
9end)

01--Local script
02 
03local ReplicatedStorage = game:GetService("ReplicatedStorage")
04local Remote = ReplicatedStorage:WaitForChild("RemoteEvent") --wait for remote
05 
06script.Parent.MouseButton1Down:Connect(function()
07    local str = "Teleporting"
08    local length = str:len()
09    for i = 1,10,.5 do
10        wait(.5)
11        if str:len() < length + 3 then
12            str = str .. "."
13      script.Parent.Parent.Button.Text = str
14        else str = "Teleporting"
15      script.Parent.Parent.Button.Text = str
16        end
17    end
18   Remote:FireServer()
19end)

Resources:

Remote Events


Accept and upvote if this helps!

Answer this question