Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont the value change?

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

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.

5 comments

0

idk how to do that

0

i tried it i didnt know how to do it correctly

0

Can you re-edit your post and include the server script you have?

0

ok

0

hello?

This discussion is preserved as it was. New answers, comments, and votes are closed.