You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make my game fully functional. When I played my game on Roblox, everything does not work. However, if I played my own game on Roblox Studio, then everything work. I’m very confused why does this happen.
Game content : When you touch grass, you die. That’s it.
- What is the issue? Include screenshots / videos if possible!
Here’s the gameplay from Roblox Studio :
Here’s the gameplay from Roblox :
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have noticedhumanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
does not fire on Roblox live game. I have only 2 possibilities, it’s either my script error or Roblox error. I’m unsure why this happen. I changed to.Changed
event, I thought it’ll work but IT STILL doesn’t work.
Just In case if anyone wonder my scripts
Module script (game.ReplicatedStorage
) :
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local TimeCooldown = 5
local collisiongroup = "Players"
local Param = RaycastParams.new()
Param.IgnoreWater = true
Param.FilterType = Enum.RaycastFilterType.Exclude
Param.CollisionGroup = collisiongroup
Param.RespectCanCollide = true
local deathMaterials = {
Enum.Material.Grass
}
local function Raycast(Origin : Vector3, Direction : Vector3, Param : RaycastParams?) : RaycastResult
local Raycast = workspace:Raycast(Origin,Direction,Param)
local Destination = Origin + Direction
Raycast = Raycast or {
Instance = nil,
Position = Destination,
Material = Enum.Material.Air,
Distance = Direction.Magnitude, -- (Destination - Source).Magnitude = Distance
Normal = nil
}
return Raycast
end
local function NewAttachment(name : string) : Attachment
local Attachment = Instance.new("Attachment")
Attachment.Name = name
return Attachment
end
local function NewSound(id : number, name : string, maxRange : number) : Sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://"..id
sound.Name = name
sound.RollOffMaxDistance = maxRange
return sound
end
local function CharacterAdded(character : Model)
local player = Players:GetPlayerFromCharacter(character)
local humanoid = character:WaitForChild("Humanoid") :: Humanoid
if RunService:IsServer() then
print("server on")
for i, v in ipairs(character:GetDescendants()) do
if v:IsA("BasePart") then
v.CollisionGroup = collisiongroup
end
end
humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
print("changed")
local floorMaterial = humanoid.FloorMaterial
if not table.find(deathMaterials,floorMaterial) or character:GetAttribute("TouchedDeathMaterial") ~= nil then
print("not passed")
return
end
print('set')
character:SetAttribute("TouchedDeathMaterial",true)
end)
end
character:GetAttributeChangedSignal("TouchedDeathMaterial"):Connect(function()
print("TouchedDeathMaterial")
if RunService:IsServer() then
print("server triggered")
task.wait(TimeCooldown)
local Explosion = Instance.new("Explosion")
Explosion.Position = character.PrimaryPart.Position
Explosion.BlastRadius = character.PrimaryPart.Size.Magnitude
Explosion.BlastPressure = character.PrimaryPart.AssemblyMass * 5000
Explosion.DestroyJointRadiusPercent = 1
Explosion.Parent = character
humanoid:TakeDamage(humanoid.Health)
else
print("client triggered")
task.wait(player:GetNetworkPing())
local LightningStrike = NewSound(1079408535,"LightingStrike",1000)
LightningStrike.Parent = character.PrimaryPart
local Highlight = Instance.new("Highlight")
Highlight.FillColor = Color3.new(1,0,0)
Highlight.OutlineColor = Color3.new(1,1,1)
Highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
Highlight.OutlineTransparency = 1
Highlight.Adornee = character
Highlight.Parent = character
local CalculatedPosition = character.PrimaryPart.Position + Vector3.new(0,5000,0)
local Attachment0 = NewAttachment("Attachment0")
local Attachment1 = NewAttachment("Attachment1")
Attachment0.Parent = character.PrimaryPart
Attachment1.Parent = character.PrimaryPart
Attachment1.WorldPosition = CalculatedPosition
local Beam = Instance.new("Beam")
Beam.Attachment0 = Attachment0
Beam.Attachment1 = Attachment1
Beam.FaceCamera = true
Beam.Color = ColorSequence.new(Color3.new(1,0,0))
Beam.Width0 = 0.5
Beam.Width1 = 0.5
Beam.Transparency = NumberSequence.new(0)
Beam.Brightness = 10
Beam.LightEmission = 1
Beam.Parent = character
local Rod = Instance.new("Part")
Rod.Shape = Enum.PartType.Cylinder
Rod.Position = Attachment1.WorldPosition
Rod.CFrame *= CFrame.Angles(0,0,math.pi/2)
Rod.Size = Vector3.new(12, 0.5, 0.5)
Rod.Material = Enum.Material.Neon
Rod.Color = Color3.new(0, 1, 1)
Rod.Name = "Thunderous_Rod"
Rod.Anchored = true
Rod.Parent = workspace
local TweenTime = TimeCooldown - player:GetNetworkPing()
local TweenInformation = TweenInfo.new(TweenTime,Enum.EasingStyle.Linear,Enum.EasingDirection.In)
local Tween = TweenService:Create(Rod,TweenInformation,{Position = Attachment0.WorldPosition})
local CalculatedRodSpeed = (Attachment0.WorldPosition - Attachment1.WorldPosition).Magnitude / TweenTime
Tween.Completed:Connect(function()
Beam:Destroy()
LightningStrike:Play()
local cast = Raycast(Rod.Position,Vector3.new(0,-5000,0),Param)
Rod.Position = cast.Position
Debris:AddItem(Rod,10)
end)
Tween:Play()
character.PrimaryPart.Anchored = true
for i, v in ipairs(character:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = true
end
end
task.wait(TimeCooldown)
character.PrimaryPart.Anchored = false
for i, v in ipairs(character:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
end
end)
end
local function PlayerAdded(player : Player)
print("player added")
player.CharacterAdded:Connect(CharacterAdded)
end
for i, v in ipairs(Players:GetPlayers()) do
PlayerAdded(v)
end
Players.PlayerAdded:Connect(PlayerAdded)
return 0
Client script (game.StarterPlayer.StarterPlayerScripts
) :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Module = ReplicatedStorage:WaitForChild("Module")
require(Module)
Server script (game.ServerScriptStorage
) :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Module = ReplicatedStorage:WaitForChild("Module")
require(Module)
If anyone know the root cause of the problem, please let me know and I’ll be appreciated if anyone know the root cause of the problem.
I’m unsure what category to put it in.
There’s no script error in Developer console.