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

How do I update my script to work with the removal of experimental mode?

Asked by 6 years ago

Hi i'm a beginner scripter and I'm currently working on a game however my script has stopped working after the removal of experimental mode. Can I please get some help on trying to make this script work. The game I'm making is a simulator and I only want the script to work when a player has picked a certain class. Thanks

also I thought I should mention that this is my first post.

Here is my script:

--Speed selected

local function touched()
        if game.StarterGui.ScreenGui.Speed.MouseButton1Click then
    game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed + 3
    local clone = script.Parent:Clone()
clone.Parent = game.ServerStorage
    script.Parent:Destroy()
wait(60)
clone.Parent = game.Workspace
    end
end

game.Workspace.Boost.Touched:Connect(touched)


--fly selected

local function touched1()
        if game.StarterGui.ScreenGui.Fly.MouseButton1Click then
    game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed + 0.5
    local clone = script.Parent:Clone()
clone.Parent = game.ServerStorage
    script.Parent:Destroy()
wait(60)
clone.Parent = game.Workspace
    end
end

game.Workspace.Boost.Touched:Connect(touched1)


--Strength selected

local function touched2()
        if game.StarterGui.ScreenGui.Strength.MouseButton1Click then
    game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed + 0.5
    local clone = script.Parent:Clone()
clone.Parent = game.ServerStorage
    script.Parent:Destroy()
wait(60)
clone.Parent = game.Workspace
        end
end

game.Workspace.Boost.Touched:Connect(touched2)

I currently have this inside a script inside a part called 'Boost' which is held in the workspace Please tell me if anymore information is needed to solve my problem. Thanks again

0
You can't access local player through normal scripts... mixgingengerina10 223 — 6y
0
could you please explain what game.StarterGui.ScreenGui.Strength.MouseButton1Click is in your world? RiskoZoSlovenska 378 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

2 Problems. 1. You have to use a LocalScript to access LocalPlayer 2. You cannot change the Gui from StarterGui. You use game.Players.LocalPlayer.PlayerGui.yourScreenGui etc. which also requires a LocalScript. To work around this, I recommend using FireClient and FireServer. They are super useful in this situation.

Ad

Answer this question