#I VERY NEED HELP
140 messages · Page 1 of 1 (latest)
this hurts to look at
BRUHH
My Local Script in TextButtons : `local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()
local Part49 = workspace.SpawnLocation.P49
script.Parent.MouseButton1Click:Connect(function()
local Money = game.Players.LocalPlayer.leaderstats.Money.Value
if Money >= 5.6 then
character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
else
button.Text = "Pas Assez"
wait(2)
button.Text = "5.6$"
end
end)***My Script in TextButtons:***local TextButton = script.Parent
local ButtonClicked = true
TextButton.MouseButton1Click:Connect(function()
if ButtonClicked then
local Money = game.Players.LocalPlayer.leaderstats.Money
Money.Value = Money.Value - 5.6
ButtonClicked = false
wait(1)
ButtonClicked = true
end
end)`
I don't lose the -$5.6 because I have a customer problem, but I don't know how to use the remoteEvent in this situation I need help it's been 2 days I'm looking for
See now
help me for that
how does the server script in serverscriptservice get the button with script.Parent
@rocky anvil script.Parent there would get ServerScriptStorage not the button
no I meant the script in textButtons*
still not good to do
** You are now Level 18! **
rankos
Compile Error! Click the
reaction for more information.
(You may edit your message to recompile.)
you also can't do LocalPlayer in a server script either since it is basically trying to call smth from the client from the server
go to ReplicatedStorage add a new folder called Events and add a new RemoteEvent called "MoneyUpdate"
-- local script
-- do all of your stuff at the top
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
script.Parent.MouseButton1Click:Connect(function()
local Money = player.leaderstats.Money
if Money.Value >= 5.6 then
--do stuff
Money.Value -= 5.6;
MoneyUpdate:FireServer(Money.Value);
end
end)
-- server script in ServerScriptStorage like it's meant to be
local event = game.ReplicatedStorage.Events.MoneyUpdate;
event.OnServerEvent:Connect(function(player, newmoney)
-- do your stuff here
end)
@rocky anvil sorry if it's messy of off I wrote it on phone
OHH
once you have that you'd need to use the newmoney arg passed from the client to the server
to do whatever you need to do
on the server
also gets player
id reccomend getting and setting the money value on the server
yeah
I replace it for all my local script or add it? because I can't delete my LocalScript because I'll use it to make my player move forward when I move forward
I'm only talking about the first script you sent
implement the stuff I put but keep a bunch of your stuff
also move that server script into server script service
that's where it's meant to go
I dont understand when you said stuff
When you mean stuff you're talking about
@ebon sun
server scripts generally aren't meant to go in client places like gui they're meant for stuff like the workspace and server script storage specifically
server script service
eck
server script service is literally meant for server scripts
im going to sent you a Picture and tell me if this is good for LocalScript if it's good, i do in Script
huh
My local script now :
`||local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
script.Parent.MouseButton1Click:Connect(function()
local Money = game.Players.LocalPlayer.leaderstats.Money.Value
if Money >= 5.6 then
character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Money.Value -= 5.6;
MoneyUpdate:FireServer(Money.Value)
else
button.Text = "Pas Assez"
wait(2)
button.Text = "5.6$"
end
end)||`
local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()
hmmmm
there should probably be another ) at the end
Nah
@ebon sun
wym nah where is the end for require
lol
where is the end ) for the require
- wtf is that require
if there are not require, i can't move Forward when i click on the boutons
.
no thats not what I said
require has two parenthesis
you have only put one
- whats the use of the controls in the whole thing anyway
I dont see any line using controls
oh and btw its not working because thats not how you do its suppose to be uh this:
Character.Humanoid:Move …. Etc
wait
where is control being used in that
lol
what
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
script.Parent.MouseButton1Click:Connect(function()
local Money = player.leaderstats.Money
if Money.Value >= 5.6 then
character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Money.Value -= 5.6;
MoneyUpdate:FireServer(Money.Value)
else
button.Text = "Pas Assez"
wait(2)
button.Text = "5.6$"
end
end
i don’t understand you are talking about what
the variable controls isnt being used anywwhere
and its dog shit
read this
local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()
😭
I've been struggling for 2 days with this RemoteEvent thing, I just want that when I press the button, my character's leaderstats loses $5.6 😭
ok
simple
make a remote event
make a server script and parent it to ServerScriptService
make a local script and parent it to StarterPlrScripts
in the server script do
try this
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
script.Parent.MouseButton1Click:Connect(function()
local Money = player.leaderstats.Money
if Money.Value >= 5.6 then
character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Money.Value -= 5.6;
MoneyUpdate:FireServer(Money.Value)
else
button.Text = "Pas Assez"
wait(2)
button.Text = "5.6$"
end
end
oh wait he wants the server to do it
hmmm
cupgirl already basically gave everything they need
hes just a dumbass ig
even chatgpt can do that
then why this mf still yapppin abt strugglin
CLIENT SCRIPT
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
script.Parent.MouseButton1Click:Connect(function()
local Money = player.leaderstats.Money
if Money.Value >= 5.6 then
Money.Value -= 5.6
MoneyUpdate:FireServer(Money.Value)
else
button.Text = "Pas Assez"
task.wait(2)
button.Text = "5.6$"
end
end
SERVER SCRIPT:
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
MoneyUpdate.OnServerEvent:Connect(function(Player, MoneyValue)
Player.Character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Player.leaderstats.Money.Value = MoneyValue
end)
THIS IS A VERY BAD WAY TO DO IT BTW
I just dont give enough shits to make it better
hold
u havent defined player
you realise remote events first parameter is the player on onserverevent..
I don't understand anything anymore, I don't know what to put or you sent too many scripts, it's very nice in any case :D, but which ones I have to use, the rest I know where to put them
just use the one I send you most recently, create a local script in the button and put this there:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
script.Parent.MouseButton1Click:Connect(function()
local Money = player.leaderstats.Money
if Money.Value >= 5.6 then
Money.Value -= 5.6
MoneyUpdate:FireServer(Money.Value)
else
button.Text = "Pas Assez"
task.wait(2)
button.Text = "5.6$"
end
end
and then create a normal/server script in serverscriptservice and put this in it:
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
MoneyUpdate.OnServerEvent:Connect(function(Player, MoneyValue)
Player.Character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Player.leaderstats.Money.Value = MoneyValue
end)
why script.Parent.MouseButton1Click
wait
script is under button
cuz the local script is in the button?
MF I DIDNT KNOW
Thanks you! Let’s try it in 5 mins, i eat :))
sob
oh
right
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
MoneyUpdate.OnServerEvent:Connect(function(Player, MoneyValue)
local Character = Player.Character
if not Character then return end
local humanoidRootPart = Character.HumanoidRootPart
Character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Player.leaderstats.Money.Value = MoneyValue
end)
Bruh where is my leaderstas
wait see
i rec
wait
Explain me why my leaderstats left 😂
@cerulean temple @proper flint
Im the most unlucky in this world
your code is just bad