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 5 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?

--[[


--]]
function Click()
script.Parent.Parent.Button.Text = "Teleporting..."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting.."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting..."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting.."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting..."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting.."

script.Parent.Parent.Parent.Parent.Character.UpperTorso.CFrame = CFrame.new(0, 0.5, 4.7) -- Place ace location coordinates here!

script.Parent.Parent.Button.Text = "Ready."

wait(2)


script.Parent.Parent.Button.Text = "Teleport"

end


script.Parent.MouseButton1Down:connect(Click)
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 — 5y

2 answers

Log in to vote
0
Answered by 5 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 — 5y
0
lol yeah Kaexotix 57 — 5y
Ad
Log in to vote
2
Answered by 5 years ago
Edited 5 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:

--Server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = Instance.new("RemoteEvent") --create remote
Remote.Parent = ReplicatedStorage

Remote.OnServerEvent:Connect(function(player)
   player.Character.UpperTorso.CFrame = CFrame.new(0,.5,4.7)
end)

--Local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("RemoteEvent") --wait for remote

script.Parent.MouseButton1Down:Connect(function()
    local str = "Teleporting"
    local length = str:len()
    for i = 1,10,.5 do
        wait(.5)
        if str:len() < length + 3 then
            str = str .. "."
      script.Parent.Parent.Button.Text = str
        else str = "Teleporting"
      script.Parent.Parent.Button.Text = str
        end
    end
   Remote:FireServer()
end)

Resources:

Remote Events


Accept and upvote if this helps!

Answer this question