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

Scripts in ScreenGui not functioning on server?

Asked by 6 years ago

Hi there, scripters! I ran into a problem when trying to make an interface located inside the player's ScreenGui. I am aware that the recent Roblox update forced FE on, but I can't seem to fix this. Any help is appreciated! Both of these scripts are inside of a textbox, inside of a ScreenGui:

Local script- indexes mouse and runs while loop:

01wait(1)
02mouse = game.Players.LocalPlayer:GetMouse()
03speed = game.ReplicatedStorage.Speed:Clone()
04speed.Parent = game.Players.LocalPlayer
05health = game.ReplicatedStorage.Health:Clone()
06health.Parent = game.Players.LocalPlayer
07 
08while wait(0.1) do
09    for i,v in pairs(script.Parent:GetChildren()) do
10        if v.Name == "SpeedButton" then
11            v.Position = UDim2.new(0,speed.Value,0,v.Position.Y.Offset)
12            script.Parent.Script.Adjust:FireServer(v,speed,health,mouse,"WalkSpeed","MaxHealth",0.17,1.05)
13        end
14        if v.Name == "HealthButton" then
15            v.Position = UDim2.new(0,health.Value,0,v.Position.Y.Offset)
View all 25 lines...

Script- receives fire server and mouse coordinates

01click = 0
02 
03script.Adjust.OnServerEvent:Connect(function(player,v,value1,value2,mouse,property1,property2,x1,x2)
04    v.MouseButton1Down:Connect(function()
05        click = 1
06        repeat
07            wait(0.01)
08            if mouse.X > 5 and mouse.X < 190 then
09                value1.Value = math.floor(mouse.X/15)*15 + 5
10                value2.Value = 190 - (math.floor(mouse.X/15)*15 + 5)
11            end
12            mouse.Button1Up:Connect(function()
13                click = 0
14            end)
15        until click == 0
16        player.Character.Humanoid[property1] = value1.Value * x1 + 10
17        player.Character.Humanoid[property2] = value2.Value * x2 + 10
18        player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth
19    end)
20end)

I'd also like to mention that this works fine in Studio, but on a server it's broken. It doesn't show any error messages in the output... Thanks!

0
speed & health need to be cloned and parented by the server and not the client Vulkarin 581 — 6y
0
I fixed that, silly mistake. It's still a unresponsive. As far as I know, the local script is firing the message successfully, but the script isn't receiving it. SnazzySpider67 53 — 6y
0
The script is located where? Vulkarin 581 — 6y
0
in a TextBox in ScreenGui. I don't know if the fact that the ScreenGui is in StarterGui is effecting the scripts or not. SnazzySpider67 53 — 6y
View all comments (5 more)
0
Server Scripts don't run in PlayerGui anymore. They run in Play Solo and in Experimental Mode but that got removed. So basically server scripts don't run there anymore. User#19524 175 — 6y
0
Yes as incapaz said you should keep your scripts in ServerScriptService Vulkarin 581 — 6y
0
Okay, I'll try that. Thanks you guys for your help! SnazzySpider67 53 — 6y
0
On the server, it displays an error that says that the argument 'v' is a nil value, I don't know why. SnazzySpider67 53 — 6y
0
Hello? SnazzySpider67 53 — 6y

Answer this question