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

Why wont the value change?

Asked by
3wdo 198
4 years ago
Edited 4 years ago

so someone fixed my script but now i got another problem. The value wont change. I need the value because i need to use it on another script. i tried int value and number value. Can someone help?

local qtable = {}
qtable[1] = "How do you say Apple in spanish"
qtable[2] = "In the rubiks cube wca, What shape is the megaminx"
qtable[3] = "What's Ikon's most liked song"
game.ReplicatedStorage.starting.OnClientEvent:Connect(function(player)
    local random = math.random(1, 3)
    print("Client Fired")
    wait(10)
    if random == 1 then 
        script.Parent.Text = "Platform 1, "..qtable[math.random(1,3)].."?"
        script.Parent.Platform.Value = 1
    elseif random == 2 then
        script.Parent.Text = "Platform 2, "..qtable[math.random(1,3)].."?"
        script.Parent.Platform.Value = 2
    elseif random == 3 then
        script.Parent.Text = "Platform 3, "..qtable[math.random(1,3)].."?"
        script.Parent.Platform.Value = 3
    end
end)

Server Script:

local plr = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local PlatForm = game:GetService("Workspace").DisapearPart

local tweeningInformation = TweenInfo.new(
    7,   
    Enum.EasingStyle.Quart,
    Enum.EasingDirection.InOut,
    0,
    false,
    0
)

local Move = {CFrame = CFrame.new(99.125, 177.707, -262.83)}
local ComeBack = {CFrame = CFrame.new(99.125, 177.707, -215.915)}
local tween1move = TweenService:Create(PlatForm,tweeningInformation,Move)
local tween1comeback = TweenService:Create(PlatForm,tweeningInformation,ComeBack)


game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        if message:lower() == "ready" then
            game.ReplicatedStorage.starting:FireClient(player)
            tween1move:Play()
            wait(70)
            tween1comeback:Play()
        else
        print("Unknown")

        end
    end)
end)

1 answer

Log in to vote
0
Answered by 4 years ago

This code is in a LocalScript, I presume, which means that when you change the values, the changes don't replicate to the server due to FilteringEnabled. What you could do is move a bunch of this stuff back to the server script, the same one where you call game.ReplicatedStorage.starting:FireAllClients() What I would suggest is have the LocalScript take care of only changing the Text. The server script could take care of the rest, generating the random numbers, deciding on which platform and which question to use, and assigning the Value which you say you need to use elsewhere.

0
idk how to do that 3wdo 198 — 4y
0
i tried it i didnt know how to do it correctly 3wdo 198 — 4y
0
Can you re-edit your post and include the server script you have? cowsoncows 951 — 4y
0
ok 3wdo 198 — 4y
0
hello? 3wdo 198 — 4y
Ad

Answer this question